﻿USE [GestionePolveri]
GO

/****** Object:  Table [GP].[POSTable]    Script Date: 08/01/2013 22:44:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [GP].[POSTable](
	[IDPOSTable] [int] IDENTITY(1,1) NOT NULL,
	[IDOperatore] [uniqueidentifier] NOT NULL,
	[IDTurno] [smallint] NOT NULL,
	[IDImpianto] [int] NOT NULL,
	[POS] [int] NOT NULL,
	[DatePOS] [datetime2](7) NOT NULL,
 CONSTRAINT [PK_POSTable] PRIMARY KEY CLUSTERED 
(
	[IDPOSTable] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [GP].[POSTable]  WITH CHECK ADD  CONSTRAINT [FK_POSTable_Impianti] FOREIGN KEY([IDImpianto])
REFERENCES [GP].[Impianti] ([IDImpianto])
GO

ALTER TABLE [GP].[POSTable] CHECK CONSTRAINT [FK_POSTable_Impianti]
GO

ALTER TABLE [GP].[POSTable]  WITH CHECK ADD  CONSTRAINT [FK_POSTable_Turni] FOREIGN KEY([IDTurno])
REFERENCES [GP].[Turni] ([IDTurno])
GO

ALTER TABLE [GP].[POSTable] CHECK CONSTRAINT [FK_POSTable_Turni]
GO

